1. Field of the Invention
The present invention relates generally to computer program generation, and more particularly, to systems and methods for user-programmable computing applications. Still more particularly, the present invention is an extensible simulation system and method wherein specialized knowledge about computer systems, languages, or programming is not required for modifying simulation functionality.
2. Description of the Background Art
Computer simulations are a powerful educational tool. In a computer simulation, groups of objects having predefined properties or characteristics typically interact according to corresponding object behavior rules that have been programmed by the creators of the simulation. Interactions between objects generate one or more corresponding predefined results or consequences according to the hard-programmed behavior rules. A user can selectively place objects in a simulation and observe their resulting interactions on a display. The results generated by a given interaction can initiate further interactions between objects, resulting in a chain of events. Computer simulations thus allow complex situations to be created and modeled.
An example of a popular computer simulation is SimCity, in which a user is responsible for the construction, maintenance, and expansion of a computer-generated city. Objects used in SimCity include roads, railroads, police stations, hospitals, and various types of buildings. Object interactions produce results such as growth, revenue, crime, traffic congestion, and pollution.
Most computer simulations are inflexible in that they do not allow the predefined object characteristics and behavior rules to be modified. As a result, the simulation is predictable and inflexible, thereby limiting its capabilities as an educational tool. For example, currently in SimCity the addition of a railroad at a given location results in the elimination of pollution problems in the vicinity of the railroad. While the addition of a railroad might aid in the reduction of pollution problems, particularly if it were used for public transportation purposes, the complete elimination of pollution problems in this example is an unrealistic scenario.
Computer simulation designers have realized that simulations are much more useful and versatile if the user is allowed to modify object properties and behavior rules. Modification of object properties and behavior rules to any significant degree, however, involves computer programming. The typical computer simulation user does not possess the specialized skills and knowledge required for computer programming. In particular, knowledge of computer program constructs and syntax are learning barriers that are difficult for children and non-technical people to overcome. Therefore, computer simulation designers have attempted to provide simulation users with a simplified means for programming the simulation.
Simplified "English-like" programming languages are one approach taken to simplify simulation programming for users. One example of this approach is the HyperTalk programming language. While such a programming language that resembles a user's native language can be easier for the user to learn, writing programs is still an abstract process. There is a conceptual gulf between what the user wants to happen in the simulation, and what he or she has to write even in these "English-like" programming languages. For example, to move an object on the simulation display, in HyperTalk the user must deal with x and y coordinates. As a result, this approach towards simplifying simulation programming has been unsuccessful.
Another approach taken to simplify simulation programming for simulation users is programming by demonstration. In programming by demonstration, a user directly manipulates objects to indicate a sequence of actions to be performed. A sequence of computer program steps that will perform each required action in the sequence is then automatically generated. While this simplifies the creation of the computer program steps for the user, a listing of such computer program steps requires specialized knowledge to understand. Because the typical simulation user does not possess such knowledge, the simulation user does not understand the relationships between demonstrated object actions, and their corresponding computer program steps. Prior art programming by demonstration systems and methods are therefore ineffective for teaching the typical simulation user about computer programming concepts.
A common construct encountered in computer programming is the conditional statement. A conditional statement specifies that if a predetermined condition holds true, then a corresponding sequence of computer program steps are to be executed. One form of the conditional statement is a Before-After rule. A Before-After rule deals with simulation states. Each Before-After rule has two parts: a "before" part and an "after" part. Each part represents a possible state of the simulation. Whenever the "before" part matches the current state of the simulation, the simulation is transformed into the state specified by the "after" part. Before-After rules are widely used in the branch of Artificial Intelligence known as "expert systems." A graphical Before-After rule is referred to herein as a Graphical Rewrite Rule (GRR). In the execution of prior art Graphical Rewrite Rules, when a graphical condition or picture matches the "before" portion of the GRR on a pixel-by-pixel basis, a sequence of computer program steps is executed that produces the graphical condition indicated by the "after" portion of the GRR.
Graphical Rewrite Rules have been applied in the prior art for simplifying computer simulation programming for users. The "before" portion of a GRR is a set of picture elements (pixels) that represent a possible graphical state or picture that can occur during a simulation's execution. The "after" portion of a GRR is a set of pixels that indicate how the picture in the simulation is to appear following an occurrence of the GRR's "before" portion in the simulation. If, during the execution of the simulation, a picture within the simulation matches a given GRR "before" portion on a pixel-by-pixel basis, a sequence of computer program steps corresponding to the GRR is executed. Execution of the sequence of computer program steps transforms the picture in the simulation that originally matched the pixels of the GRR's "before" portion into a picture that matches the pixels of the GRR's "after" portion.
For each simulation object, the simulation user creates a GRR for each possible simulation state of interest. Even in relatively simple simulations, each simulation object can participate in a large number of distinct simulation states. Therefore, an undesirably large number of GRR definitions must be made for each object. This drawback has limited the use of Graphical Rewrite Rules as a means for simplifying simulation programming.
In the definition of a GRR, the user graphically specifies the corresponding "before" and "after" portions of the GRR. The sequence of computer program steps that results in the graphical transformation of the "before" portion into the "after" portion is generated automatically, thereby greatly simplifying simulation programming for the user. Some systems and methods have tried to have the computer infer how to arrive at the after state from the before state. However, this is currently an unsolved problem in computer science, and such systems and methods have not succeeded.
During the execution of a simulation, one or more characteristics or properties of an object may change according to one or more applicable rules. The set of properties corresponding to an object represents its internal state. An object's internal state can influence the object's behavior. For example, an object representing a living creature may have a property corresponding to hunger. If the creature's hunger exceeds a certain level, the creature may subsequently search for food rather than initiate another behavior. In general, changes to an object's internal state in prior art simulation systems and methods occur without the user's knowledge. That is, they occur invisibly during the execution of a simulation. In addition, the simulation user cannot define or modify an object's internal state after simulation execution has begun. When the user's knowledge of and access to each object's internal state is limited, the simulation again becomes less effective as an educational tool.
Therefore, there is a need for a means of providing simulation users with flexible control over simulation information and simulation behavior without requiring specialized programming knowledge.